/*
 * Copyright 2022 FA-Software (Shanghai) Co., Ltd. All Rights Reserved.
 *
 * Licensed under the FA-Software License, Version 1.0;
 * https://www.fa-software.com/licenses/LICENSE-1.0
 */
package com.eric.study.reactor.commons.response;

import lombok.Getter;

/**
 * <p>
 * 请求返回状态响应码，参考 <a href="https://tools.ietf.org/html/rfc7231#section-6.3.1">HTTP/1.1</a>
 *
 * <p>
 * change history:
 *
 * <pre>
 * date         defect       person          comments
 * --------------------------------------------------------------------------------
 * 2023/6/7    ********     Qiheng Zhang    create file.
 * </pre>
 *
 * @author Qiheng Zhang
 * @date 2023/6/7 16:31
 * @copyright 2023, FA Software (Shanghai) Co., Ltd. All Rights Reserved.
 * @since 1.0.0
 */
@Getter
public enum ResponseStatus {

    // 2xx Success

    /**
     * {@code 200 OK}.
     * @see <a href="https://tools.ietf.org/html/rfc7231#section-6.3.1">HTTP/1.1:
     * Semantics and Content, section 6.3.1</a>
     */
    OK(200),

    // --- 4xx Client Error ---

    /**
     * {@code 400 Bad Request}.
     * @see <a href="https://tools.ietf.org/html/rfc7231#section-6.5.1">HTTP/1.1:
     * Semantics and Content, section 6.5.1</a>
     */
    BAD_REQUEST(400),
    /**
     * {@code 401 Unauthorized}.
     * @see <a href="https://tools.ietf.org/html/rfc7235#section-3.1">HTTP/1.1:
     * Authentication, section 3.1</a>
     */
    UNAUTHORIZED(401),

    // --- 5xx Server Error ---

    /**
     * {@code 500 Internal Server Error}.
     * @see <a href="https://tools.ietf.org/html/rfc7231#section-6.6.1">HTTP/1.1:
     * Semantics and Content, section 6.6.1</a>
     */
    INTERNAL_SERVER_ERROR(500),

    /**
     * {@code 502 Bad Gateway}.
     * @see <a href="https://tools.ietf.org/html/rfc7231#section-6.6.3">HTTP/1.1:
     * Semantics and Content, section 6.6.3</a>
     */
    BAD_GATEWAY(502),
    /**
     * {@code 503 Service Unavailable}.
     * @see <a href="https://tools.ietf.org/html/rfc7231#section-6.6.4">HTTP/1.1:
     * Semantics and Content, section 6.6.4</a>
     */
    SERVICE_UNAVAILABLE(503),
    /**
     * {@code 504 Gateway Timeout}.
     * @see <a href="https://tools.ietf.org/html/rfc7231#section-6.6.5">HTTP/1.1:
     * Semantics and Content, section 6.6.5</a>
     */
    GATEWAY_TIMEOUT(504);

    /**
     * 状态码
     */
    private final int value;

    ResponseStatus(int value) {
        this.value = value;
    }

}
